package chloroform.exec

import chloroform.{InstanceExecutorContext, InstanceExecutor}

/**
 * Created by IntelliJ IDEA.
 * User: zslajchrt
 * Date: 16.4.11
 * Time: 12:37
 * To change this template use File | Settings | File Templates.
 */

object RunnableExecutor extends InstanceExecutor {
  def execute(instance: Any, context: InstanceExecutorContext) = {
    if (instance.isInstanceOf[Runnable]) {
      instance.asInstanceOf[Runnable].run
//      val writer = context.response.getWriter
//      writer.write(instance.toString)
//      writer.flush
    } else context.chain.execute
  }
}